package cn.chengpengper.seckill.stock.application.model.dto;

import cn.chengpengper.seckill.stock.domain.model.entity.SeckillStockBucket;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @author chengpeng.hu
 */
@Data
@Builder
@AllArgsConstructor
public class SeckillStockBucketDTO implements Serializable {

    private static final long serialVersionUID = -2678984084602683732L;

    private Integer totalStock;

    private Integer availableStock;

    private Integer bucketsQuantity;

    private List<SeckillStockBucket> buckets;

    public SeckillStockBucketDTO() {
    }

    public SeckillStockBucketDTO(Integer totalStock, Integer availableStock, List<SeckillStockBucket> buckets) {
        this.totalStock = totalStock;
        this.availableStock = availableStock;
        this.buckets = buckets;
        this.bucketsQuantity = buckets.size();
    }

}
